<!--
 * @Descripttion: prop/$emit
 * @Author: jiansheng
 * @Date: 2021-11-29 09:13:03
-->
<template>
  <div>
    <p @click="clickDemoBtn">props/$emti</p>
    <p @click="changeArray">点击更改 Array 的某个值</p>

    <p @click="changeBus">bus传递</p>
  </div>
</template>
<script>
import Bus from '@/assets/utils/bus'
export default {
  props: {
    propObj: { type: Array, default: () => [] },
    propNum: { type: Number, default: 0, required: true, validator: val => val < 110 }
  },
  data() {
    return {
      tempDataPropNum: this.propNum,
      tempPropObj: this.propObj
    }
  },
  methods: {
    clickDemoBtn() {
      this.$emit('changePropDemoNum', ++this.tempDataPropNum)
    },
    changeArray() {
      this.tempPropObj[0].a = 100
    },
    changeBus() {
      Bus.$emit('testBus', 111111)
    }
  },
}
</script>
<style lang="less" scoped>
p{
  cursor: pointer;
  &:hover{
    color: blue;
  }
}
</style>